Raspberry Pi Operating System Assembly Language: Hands-On-Guide by Smith Bruce & Smith Bruce

Raspberry Pi Operating System Assembly Language: Hands-On-Guide by Smith Bruce & Smith Bruce

Author:Smith, Bruce & Smith, Bruce [Smith, Bruce]
Language: eng
Format: epub
Publisher: bruce smith book
Published: 2021-03-17T00:00:00+00:00


The three registers R1, R2, and R3 are stored within the gap we have created as illustrated in Figure 17f. You will need to remember to close this gap in the stack when you have finished the operation you needed the space for:

ADD SP, #12

It is quite common to use this method to preserve register contents before calling a function (see Chapter 21).

 Figure 17f. Forming a stack frame ‘gap’.

Frame Pointer

When a lot of use of the stack is being made it can be difficult to remember where things are, and what offset is what. Rather than use the SP and offsets we can invoke a Frame Pointer—this is a pointer to the stack frame. It is common convention to use R11 as the FP, but this is not a hard and fast rule. Just remember to push the registers contents onto the stack, so it can be restored later. After creating the stack frame, we can set the FP to next free spot on the stack (remembering it grows in descending addresses).

SUB FP, SP, #4

SUB SP, #12



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.